<?php // Submit Question
require_once('./inc/inc.common.php');
$tmpl 			= new mvTemplate();
$tmpl->page_title('Submit Question');

if(isset($_POST['question']) && strlen($_POST['question']) > 25){
	$userID = isset($_SESSION['user']) ? $_SESSION['user']->id : '';
	$a = article::create('Question', $userID, $_POST['question'], '', false, "Q");

	if($a){
		mvError::userNotice('Question Added', 'Your has been added. Thank you for your submission.');
		header('location: index.php');
		die();
	}else{
		mvError::userError('Unknown error', 'Your question could not be added.');
	}
}elseif(isset($_POST['question']) && strlen($_POST['question']) <= 25){
	mvError::userError('Short Question', 'Please enter at least 25 characters for your question.');
}

$tmpl->page_display('q.tpl');
?>